#include <iostream>
#include <string>
#include <stack>

bool isBalanced(const std::string& input) {
    std::stack<char> st;

    for (char c : input) {
        if (c == '(' || c == '[' || c == '{') {
            st.push(c);
        } else if (c == ')' || c == ']' || c == '}') {
            if (st.empty()) {
                return false;
            }
            char top = st.top();
            st.pop();

            if ((c == ')' && top != '(') ||
                (c == ']' && top != '[') ||
                (c == '}' && top != '{')) {
                return false;
            }
        }
    }

    return st.empty();
}

int main() {
    std::string input;
    std::cout << "Enter a string with brackets: ";
    std::cin >> input;

    if (isBalanced(input)) {
        std::cout << "The number of parentheses in a line is even." << std::endl;
    } else {
        std::cout << "The number of parentheses in a line is even." << std::endl;
    }

    return 0;
}
